<script>
	$(function() {
		$( ".datepicker" ).datepicker();
	});
        
        function on_change_customer()
        {
            $.post("<?php echo DATACUSTOMER ?>get_data_customer_autocomplete", "no_pengenal="+$("#no-pengenal").val()+"&&jenis_pengenal="+$("#jenis-pengenal").val(), function(data){
                var arr = $.parseJSON(data);
                if (arr['no_pengenal']!='')
                {
                    $("#country-of-passport").val(arr['country_of_passport']);
                    $("#first-name").val(arr['first_name']);
                    $("#last-name").val(arr['last_name']);
                    $("#id-data-customer").val(arr['id']);
                }
                else
                    $("#status-data-customer").val('-');
            });
            
            $.post("<?php echo DATACUSTOMER ?>get_data_customer_autocomplete", "no_pengenal="+$("#no-pengenal").val()+"&&jenis_pengenal="+$("#jenis-pengenal").val(), function(data){
                var arr = $.parseJSON(data);
                if (arr['no_pengenal']!='')
                {
                    $("#country-of-passport").val(arr['country_of_passport']);
                    $("#first-name").val(arr['first_name']);
                    $("#last-name").val(arr['last_name']);
                    $("#status-data-customer").val(arr['id']);
                }
                else
                    $("#status-data-customer").val('-');
            });
        }
        
        $(document).ready(function(){
            $("#jenis-pengenal").change(function() {
                    on_change_customer();
                });
                $("#no-pengenal").keyup(function() {
                    on_change_customer();
                });
            
            $( "#jumlah-hari" ).keyup(function() {
                    var jumlah_hari = parseInt($( "#jumlah-hari" ).val());
                    var date_masuk = new Date($("#date-pesan-masuk").val())
                    
                    var d = date_masuk.getDate();
                    var m = date_masuk.getMonth();
                    var y = date_masuk.getYear();
//                    var NextDate= new Date((1900+y), (d+jumlah_hari), (m));
                    var NextDate= new Date();
                    NextDate.setDate(date_masuk.getDate()+jumlah_hari);
//                    alert(NextDate.getYear());
                    $("#date-pesan-keluar").val((NextDate.getMonth()+1)+"/"+NextDate.getDate()+"/"+(1900+NextDate.getYear()));
                    })
		
	});
	</script>
<form action="<?php echo HOME ?>checkout_kamar_process">
    nama kamar : <text id="nama-kamar"></text><br />
    <input type="hidden" name="id_kamar" id="id-kamar" value=""/>
    <text id="tipe-letak-kamar"></text> : <text id="no-letak-kamar"></text><br />
    nomor : <text id="no-kamar"></text><br />
    <br />
    data pelanggan <br />
    nomor pengenal : <input name="no_pengenal" id="no-pengenal" value=""/><br />
    jenis pengenal : <select name="jenis_pengenal" id="jenis-pengenal">
        <option >ktp</option>
        <option >sim</option>
        <option >passport</option>
    </select><br />
    country of passport : <input name="country_of_passport" id="country-of-passport" value=""/><br />
    first name : <input name="first_name" value="" id="first-name"/><br />
    last name : <input name="last_name" value="" id="last-name"/><br />
    <text id="error"></text>
    <input type="hidden" name="id_data_customer" value="" id="id-data-customer">
    <br />
    
    



        jumlah hari pesan: <input type="text" id="jumlah-hari" /><br />
        Tanggal pesan masuk: <input type="text" class="datepicker" id="date-pesan-masuk" name="date_pesan_masuk" value="<?php echo date("m")."/".date("d")."/".date("Y") ?>"><br />
        Tanggal pesan keluar: <input type="text" class="datepicker" id="date-pesan-keluar" name="date_pesan_keluar" value="<?php echo date("m")."/".date("d")."/".date("Y") ?>"><br />
        jumlah orang menginap: <input type="text" name="jumlah_huni" id="jumlah-huni" value=""/><br />
        <input type="hidden" name="id_customer" id="id_customer" value="">
        <br />
        <br />
        <div id="tagihan">
        </div>
        <br />
        
        jenis pembayaran : <select name="pembayaran_trax">
        <option>tunai</option>
        <option>cek</option>
        <option>passport</option>
    </select><br />
        
        jumlah : <input name="harga_trax" /><br />
        keterangan : <input name="keterangan" /><br />
        <input name="adjoin_status" type="hidden" value="<?php echo $customer['adjoin_to']?>">
    <input type="submit"  class="tombol"/><br />
</form>